package org.sy.lab.Java7并发编程实战.七定制并发类.四在Executor对象中使用ThreadFactory;

import java.util.concurrent.ThreadFactory;

public class MyThreadFactory implements ThreadFactory {
	private int counter;
	private String prefix;
	public MyThreadFactory(String prefix) {
		this.prefix = prefix;
		counter = 1;
	}
	@Override
	public Thread newThread(Runnable r) {
		MyThread myThread = new MyThread(r, prefix + "-" + counter);
		counter++;
		return myThread;
	}
}
